#!/usr/bin/python3
import urllib.request
import urllib.parse
import ssl
import json
import re
import hashlib
import time
def request():
  request = urllib.request.Request(
      "https://www.showdoc.cc/server/index.php?s=/api/item/info")
  request.headers = {
      'Accept': 'application/json, text/javascript, */*; q=0.01',
      'Accept-Language': 'zh-CN',
      'Connection': 'Keep-Alive',
      'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
      'Cookie': 'UM_distinctid=1684f16bbc8106-079635b7f58cc3-162a1c0b-1fa400-1684f16bbc9836; Hm_lvt_db266ac6f3a6a9d996167fc85c536ab4=1556508946,1556516869,1556613177,1556676345; cookie_token=7a34df8c3153a88928c889556e2f3350fa8b7d12310ba9a6f01e7744fadeaebc; SL_GWPT_Show_Hide_tmp=1; SL_wptGlobTipTmp=1; PHPSESSID=c12hlaeteccophtgrmrtq8kt1d; think_language=zh-CN; CNZZDATA1259614235=514009084-1547510587-%7C1557371558',
      'Host': 'www.showdoc.cc',
      'Origin': 'https://www.showdoc.cc',
      'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134',
  }

  data = {
    'item_id': '336018192103290',
    'default_page_id': '1950564225760223'
    # 'doctype': 'json',
    # 'from': 'zh-CHS',
    # 'i': origin,
    # 'keyfrom': 'fanyi.web',
    # 'salt': str(int(time.time() * 1000)),
    # 'smartresult': 'dict',
    # 'to': to,
    # 'typoResult': 'false',
    # 'version': '2.1'
  }

  request.data = urllib.parse.urlencode(data).encode('utf-8')
  context = ssl._create_unverified_context()
  # f = urllib.request.urlopen(request, data, context=context)

  response = urllib.request.urlopen(request, context=context)
  print(response.read().decode('utf-8'))


url=sys.argv[1]
cookie = sys.argv[2]
cookie = sys.argv[2]
request()
